#define _CRT_SECURE_NO_WARNINGS 1

#include"My_vector.h"




void test_insert()
{
	Bottle::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;

	Bottle::vector<int>::iterator it = v.begin();

	v.insert(it, 0);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;

	v.insert(v.begin() + 3, 3);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;

	v.insert(v.begin() + 2, 2);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;

}

void test_resize()
{
	Bottle::vector<int> v(13, 7);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;

	v.resize(3);
	v.push_back(3);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;

	Bottle::vector<std::string> v2;
	v2.resize(5, "xxx");
	for (size_t i = 0; i < v2.size(); ++i)
	{
		std::cout << v2[i];
		std::cout << " ";
	}
	std::cout << std::endl;
}

void test_push_back()
{
	Bottle::vector<int> v;
	v.push_back(1);
	v.push_back(1);
	v.push_back(1);
	v.push_back(1);
	v.push_back(1);
	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;
}

void test_erase()
{
	Bottle::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(2);
	v.push_back(4);
	v.push_back(5);
	v.push_back(4);
	v.push_back(8);
	v.push_back(5);
	v.push_back(6);


	Bottle::vector<int>::iterator it = v.begin();
	while (it < v.end())
	{
		if (*it % 2 == 0)
		{
			it = v.erase(it);
		}
		else
		{
			++it;
		}
	}

	for (size_t i = 0; i < v.size(); ++i)
	{
		std::cout << v[i];
	}
	std::cout << std::endl;


}

void test_cc()
{
	Bottle::vector<int> v1(3, 7);
	Bottle::vector<int> v2(v1);
	for (size_t i = 0; i < v2.size(); ++i)
	{
		std::cout << v2[i];
	}
	std::cout << std::endl;
}


void test_ic()
{
	std::string s("abcdefghijk");
	Bottle::vector<char> s_v(s.begin(), s.end());

	for (size_t i = 0; i < s_v.size(); ++i)
	{
		std::cout << s_v[i];
	}
	std::cout << std::endl;
}


int main()
{
	//test_push_back();
	//test_resize();
	//test_insert();

	//test_erase();

	test_cc();

	//test_ic();

	/*int vi = int(2);
	std::cout << vi << std::endl;*/

	/*int a = 1;
	const int& b = a;*/


	return 0;
}